package pt.nmfa.peste.session;

import pt.nmfa.peste.entity.*;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityQuery;
import java.util.Arrays;

@Name("tvProgramList")
public class TvProgramList extends EntityQuery<TvProgram> {

	private static final String EJBQL = "select tvProgram from TvProgram tvProgram";

	private static final String[] RESTRICTIONS = {
			"lower(tvProgram.name) like lower(concat(#{tvProgramList.tvProgram.name},'%'))",
			"lower(tvProgram.shortDescription) like lower(concat(#{tvProgramList.tvProgram.shortDescription},'%'))",
			"lower(tvProgram.longDescription) like lower(concat(#{tvProgramList.tvProgram.longDescription},'%'))",
			"lower(tvProgram.id) like lower(concat(#{tvProgramList.tvProgram.id},'%'))", };

	private TvProgram tvProgram = new TvProgram();

	public TvProgramList() {
		setEjbql(EJBQL);
		setRestrictionExpressionStrings(Arrays.asList(RESTRICTIONS));
		setMaxResults(25);
	}

	public TvProgram getTvProgram() {
		return tvProgram;
	}
}
